package leetcode.linkedlist;

import leetcode.linkedlist.common.LinkedListUtils;
import leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 * int val;
 * ListNode next;
 * ListNode() {}
 * ListNode(int val) { this.val = val; }
 * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution148 {
    public ListNode sortList(ListNode head) {
        return LinkedListUtils.sortList(head);
    }
}

public class leetcode148 {
    public static void main(String[] args) {
        Solution148 solution148 = new Solution148();
        int[] nums = {4, 2, 1, 3};
        test148(solution148, nums);
    }

    private static void test148(Solution148 solution148, int[] nums) {
        ListNode head = solution148.sortList(LinkedListUtils.generateLinkedListByArray(nums));
        System.out.println(LinkedListUtils.getLinkedListVals(head));
    }
}
